"""
# -*- coding: utf-8 -*-
# @Time    : 2023/6/13 17:31
# @Author  : 王摇摆
# @FileName: Multiclass.py
# @Software: PyCharm
# @Blog    ：https://blog.csdn.net/weixin_44943389?type=blog
"""

# 导入数据
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt

digits = load_digits()

# 数据集切分
X_train, X_test, y_train, y_test = train_test_split(digits['data'], digits['target'], test_size=0.2)

fig, axes = plt.subplots(10, 16, figsize=(8, 8))
fig.subplots_adjust(hspace=0.1, wspace=0.1)
for i, ax in enumerate(axes.flat):
    ax.imshow(X_train[i, :].reshape(8, 8), cmap='binary', interpolation='nearest')
    ax.text(0.05, 0.05, str(y_train[i]),
            transform=ax.transAxes, color='blue')
    ax.set_xticks([])
    ax.set_yticks([])
'''
显示数据集子图
'''
plt.show()
